<?php

namespace common\filters;

use Yii;

/**
 *
 */
class BaseFilter extends \yii\base\ActionFilter
{

    public $except = null;

    /**
     *
     * @return boolean
     */
    protected function checkExcept()
    {
        if (!$this->except) {
            return false;
        }
        foreach ($this->except as $item) {
            $info = explode('.', $item);
            $controller = $info[0];
            $action = $info[1];
            if ($controller == '*') {
                return true;
            }
            if (Yii::$app->controller->id != $controller) {
                continue;
            }
            if ($action == '*') {
                return true;
            }
            if (Yii::$app->controller->action->id == $action) {
                return true;
            }
        }
        return false;
    }

}
